package com.aaa.service.impl;

import com.aaa.dao.PersonUserDao;
import com.aaa.pojo.ChangeMoney;
import com.aaa.pojo.PersonUser;
import com.aaa.service.PersonUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PersonUserServiceImpl implements PersonUserService {
    @Autowired
    private PersonUserDao personUserDao;
    @Override
    public List<PersonUser> selectPersonal() {
        return personUserDao.selectPersonal();
    }

    @Override
    public PersonUser selectPerUserByPid(Integer pid) {
        return personUserDao.selectPerUserByPid(pid);
    }

    @Override
    public PageInfo<PersonUser> getPersonUserByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//这行是重点，表示从pageNum页开始，每页pageSize条数据
        List<PersonUser> list = personUserDao.selectPersonal();
        PageInfo<PersonUser> pageInfo = new PageInfo<PersonUser>(list);
        return pageInfo;
    }

    @Override
    public List<String> getChangeColumn() {
        return null;
    }

    @Override
    public Boolean updatePersonal(Integer pid, String username, String pname,Long phone,String email) {
        return personUserDao.updatePersonal(pid, username, pname, phone, email);
    }

    @Override
    public Boolean deletePersonal(Integer pid) {
        return personUserDao.deletePersonal(pid);
    }

    @Override
    public Boolean updateUser(Integer uid) {
        return personUserDao.updateUser(uid);
    }

    @Override
    public PersonUser selectByUid(Integer uid) {
        return personUserDao.selectByUid(uid);
    }

    @Override
    public Integer selectPwdByUid(Integer uid) {
        return personUserDao.selectPwdByUid(uid);
    }
}
